home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.gu.edu.au!usenet
- From: Student (Student)
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: C++ Programming Question From Dummy(s)
- Date: 20 Apr 1996 07:18:46 GMT
- Organization: Griffith University
- Message-ID: <4la34m$k5q@griffin.itc.gu.edu.au>
- References: <4l81i1$2uq@murphy2.servtech.com>
- NNTP-Posting-Host: enslab13.student.gu.edu.au
- X-Newsreader: WinVN 0.92.5
-
- In article <4l81i1$2uq@murphy2.servtech.com>, joeypoey@servtech.com (Joey) says:
-
- >write a program that 1) reads text from a file(one word so happens) and then
- >2) opens another file and searchs to see if that word is within the 2nd file
- >which is NOT one word but a series of ONE line entries with about 5 words/#'s
- >in each line.
-
- Tim's cool word grabing algorithm:
- goto start of word in file #1
- read character from file #1
- if character not ' ' then add character to buffer
- else word = buffer
-
- Tim's cool word finding algorithm:
- open file #2
- goto start of file #2
- Loop:
- if eof(2) exit "not found"
- compare character from file #2 with the first character of word.
- if match then compare secondletter with next position
- and so forth until end of word -> exit "found"
- increment position in file #2
- EndLoop
- /* please don't anyone say I should have used recursion unless
- it is reallly necessary for their health */
-
-
- the commands you will be using are your file i/o commands in <dos.h>
- so if your not sure about them, click your right mouse button
- (in the c environment) and you should get a help index.
- then type dos.h <enter>
- and it will list the commands contained in this file.
- you can then look at the examples and so forth.......
- hope this is sort of what you were asking about,
- if not then write back an complain.
-
-
- >
- >Anyone willing to discuss some bare bones basics via E-Mail with me? Would
-
- sure.... my email is tpratley@cit.gu.edu.au,
- but why not just have a group discussion here?
-